# Maintainer: Will Sinatra <wpsinatra@gmail.com>
# Contributor: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-notify
_gemname=${pkgname#ruby-}
pkgver=0.5.2
pkgrel=0
pkgdesc="ruby desktop notification library"
url="https://rubygems.org/gems/notify"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-rake ruby-bundler"
source="$pkgname-$pkgver.tar.gz::https://github.com/jugyo/notify/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_gemname-$pkgver"
subpackages="$pkgname-doc"
options="!check" # tests depend on ruby-jeweler

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc

	install -Dm644 "$builddir"/LICENSE "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
}

sha512sums="
e2bd21d700c5941818a6cd6c9046f9a38967f925cf1fac3db8e14d36b00d26fd2f323646ace840b1034e1526cd210887b290dcdfea5598596f86ac59d3662ff7  ruby-notify-0.5.2.tar.gz
"
